<?php
namespace app\admin\controller;

class Memberbouns extends Admin{
    public function __construct(){
        parent::__construct();
        $this->model = "MemberBouns";
        $this->assign("model",$this->model);
    }

    public function get_where_map(){
        $whereData = input("param.whereData/s");
        $whereData = urldecode($whereData);
        $whereDatas = [];
        // if ($whereData) {
        //     $whereData = explode('&', $whereData);
        //     foreach ($whereData as $v) {
        //         $r = explode('=', $v);
        //         if ($r[0] == 'keywords') {
        //             $whereDatas['id|name'] = ['like', '%'.$r[1].'%'];
        //         }else{
        //             $whereDatas[$r[0]] = $r[1];
        //         }
        //     }
        // }
        // if ($this->uinfo['roleid'] == '6') {
        //     $whereDatas['dealerid'] = $this->uinfo['dealerid'];
        // }
        return $whereDatas;
    }

    public function audit(){
    	$ids = input('ids/s');
        $info = model($this->model)->where('id', $ids)->find();
        if ($info['status'] != 0) {
            return json(['status'=>0,'msg'=>'请不要重复操作']);
        }
    	$isok = model($this->model)->where('id', $ids)->update(['status'=>1,'adminid'=>$this->uinfo['userid'],'sendtime'=>time()]);
    	if ($isok === false) {
    		return json(['status'=>0,'msg'=>'操作失败！']);
    	}
    	return json(['status'=>1,'msg'=>'发放成功！']);
    }
}